<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="model1.BoardTO" %>
<%@ page import="model1.BoardDAO" %>

<%
	request.setCharacterEncoding("utf-8");
	BoardTO to=new BoardTO();
	
	to.setSubject(request.getParameter("subject"));
	to.setWriter(request.getParameter("writer"));
	to.setMail(request.getParameter("mail"));
	to.setPasswd(request.getParameter("passwd"));
	to.setContent(request.getParameter("content"));
	to.setWip(request.getRemoteAddr());	//접속자 ip 알아내기

	BoardDAO dao = new BoardDAO();
	boolean flag=dao.write(to);
	
	out.print("<script language='javascript'>");
	if(flag){
		out.print("alert('글쓰기가 완료되었습니다.');");
		out.print("location.href='board_list1.jsp';");
	}else{
		out.print("alert('다시 작성해 주세요');");
//		out.print("history.go(-1)");
		out.print("history.back();");
	}
	
	out.print("</script>");
	
%>







